﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using shop.entity;
using shop.dao;
using shop.exception;

namespace shop.service
{
    public class GoodsService
    {
        private GoodsDao goodsDao = new GoodsDao();
        public List<Goods> ListGoods(int count,Goods goods) {
            if (count == 0) {
                count = 15;
            }
            
            return goodsDao.ListGoods(count,goods);
        }

        public Goods getGoods(int id)
        {
            return goodsDao.GetGoods(id);
        }
        public List<Goods> GetGoodsByCategoryId(int categoryId,int count)
        {
            return goodsDao.GetGoodsByCategoryId(categoryId,count);
        }

        public List<Goods> GetCarousels()
        {
            return goodsDao.GetCarosels();
        }

        public bool AddGoods(Goods goods)
        {
            
            return goodsDao.AddGoods(goods);
        }
        public bool UpdateGoods(Goods goods)
        {
            return goodsDao.UpdateGoods(goods);
        }
        public bool DeleteGoods(int id)
        {
          return  goodsDao.DeleteGoods(id);
           
        }
    }
}